-
Notifications
You must be signed in to change notification settings - Fork 178
Scale width of Caret w.r.t. the native zoom #2471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Scale width of Caret w.r.t. the native zoom #2471
Conversation
e13d50f
to
38cac4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change currently introduces a regression:
I tested the change and printed out the old and new values for comparison. Turns out that the new method call always writes 0
to the passed buffer and, in particular, the method call always returns false
, such that the size is not taken into account.
One example consequence is that if I set a high OS cursor size (like 10), the cursor is still 1 pixel wide. For example, in a console window it used to look like this (with OS cursor size 10):
And now it looks like this:
Note that the documentation of the used method states that it cannot be called with SPI_GETCARETWIDTH
as done here but will always return 0
in that case: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfofordpi#remarks
38cac4f
to
ac7d9d5
Compare
@HeikoKlare Turns out SystemParametersInfo doesn't work with SPI_GETCARETWIDTH : https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfofordpi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal should be to make sure this doesn't cause any regression.
If I understand correctly, there was actually a bug that this PR now resolves: before, the cursor width was not scaled according to the monitor. So, e.g., a Windows setting of cursor size 10 would have resulted in pixel-width 10 for the cursor on both a 100% and 150% monitor whereas now on the 150% monitor the width will be 15 pixels.
So would be good to have that properly documented in the commit and PR messages.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java
Outdated
Show resolved
Hide resolved
ac7d9d5
to
476a5bd
Compare
This commit adapts the retrieval of width of Caret SystemParametersInfo to be scaled as per the native zoom of the widget as SystemParametersInfo retrieves value for the primary zoom at startup.
476a5bd
to
3f54b85
Compare
This PR adapts the retrieval of width of Caret SystemParametersInfo to be scaled as per the natie zoom as SystemParametersInfo retrieves value for the primary zoom at startup.